package tongwentongshu.com.app.activity;

import android.support.v4.util.ArrayMap;
import android.view.View;

import java.util.Map;

import butterknife.OnClick;
import tongwentongshu.com.app.R;
import tongwentongshu.com.app.bean.AppItem;
import tongwentongshu.com.app.db.Cache;
import tongwentongshu.com.app.network.ResponseSubscriber;
import tongwentongshu.com.app.update.UpdateFractory;

/**
 * Created by XiongBin on 2017/7/28.
 */

public class RefundActivity extends BaseActivity {
    private Map<String, String> map;

    @Override
    protected int getLayoutResourceId() {
        return R.layout.activity_refund;
    }

    @Override
    protected int getTitleId() {
        return R.string.refund;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }

    @OnClick({R.id.btn_ok})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_ok:
                refund();
                break;
        }
    }

    public void refund() {
        map = new ArrayMap<>();
        map.put("token", Cache.getToken());

        UpdateFractory.getBuild()
                .name("BackMoneyCall")
                .map(map)
                .build()
                .execute(new ResponseSubscriber<AppItem>() {

                    @Override
                    public void onFailure(Throwable e) {
                        e.printStackTrace();
                    }

                    @Override
                    public void onSuccess(AppItem myshare, String msg) {
                        finish();
                    }

                    @Override
                    public void onCompleted() {
                        super.onCompleted();
                    }
                });
    }
}
